package com.bdqn.service.impl;

import com.bdqn.mapper.UserMapper;
import com.bdqn.pojo.User;
import com.bdqn.service.UserService;
import com.bdqn.util.LayData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <Description> <br>
 *
 * @author tao<br>
 * @version 1.0<br>
 * @taskId: <br>
 * @createDate 2019/09/06 16:19 <br>
 * @see com.bdqn.service.impl <br>
 */
@Service("userService")
public class UserServiceImpl implements UserService {

    @Resource
    private UserMapper userMapper;

    @Override
    public User login(String username,String password) {
        return userMapper.login(username,password);
    }

    @Override
    public Long addSave(User user) {
        return userMapper.addSave(user);
    }

    @Override
    public Long del(Long id) {
        return userMapper.del(id);
    }

    @Override
    public LayData getAll(User user, Long currentPage,Long pageSize) {
        return LayData.data(userMapper.count(user),userMapper.getAll(user,(currentPage-1)*pageSize,pageSize));

    }


}
